package type;

/**
 * @Date 2021/4/29 7:27 下午
 * @Author dengxin
 */
public class Generic6 {

    static class Car {};

    static class Metlza extends Car {};

    public static void main(String[] args) {
        Car car = new Car();
        Metlza metlza = new Metlza();
//        System.out.println(car instanceof Car);
//        System.out.println(metlza instanceof Car);
//        System.out.println(car.getClass().isInstance(car));
//        System.out.println(metlza.getClass().isInstance(car));
//        System.out.println(car.getClass() == Car.class);
////        System.out.println(metlza.getClass() == Car.class);
//        System.out.println(car.getClass().equals(Car.class));
//        System.out.println(metlza.getClass().equals(Car.class));
        compare(car);
        compare(metlza);
    }

    private static void compare(Object obj) {
        System.out.println(obj instanceof Car);
        System.out.println(obj instanceof Metlza);
        System.out.println(Car.class.isInstance(obj));
        System.out.println(Metlza.class.isInstance(obj));
        System.out.println(obj.getClass() == Car.class);
        System.out.println(obj.getClass() == Metlza.class);
        System.out.println(obj.getClass().equals(Car.class));
        System.out.println(obj.getClass().equals(Metlza.class));
    }
}
